package com.example.test.dialogfactory;

import android.Manifest.permission;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AlertDialog.Builder;
import androidx.appcompat.app.AppCompatActivity;
import com.example.test.dialogfactory.service.MyIntentService;
import easier.app.x.CommonCode;
import easier.app.x.result.Permission;
import easier.app.x.result.location.LocationPermissionServiceFunctionDialogImpl;
import easier.app.x.result.pic.TakePhoto;
import easier.app.x.result.starter.StartForResult;
import easier.app.x.starter.IntentBuilder;
import easier.log.logger.Logger;
import easier.window.Item;
import easier.window.dialog.bottom.BottomDialogFragment;
import easier.window.dialog.bottom.impl.SimpleBottomChooseDialogFragment;
import easier.window.dialog.impl.CancelConfirmDialogFragment;
import easier.window.dialog.impl.ConfirmDialogFragment;
import easier.window.picker.CalendarPickerFactory;
import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.ObservableEmitter;
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
import io.reactivex.rxjava3.core.ObservableSource;
import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.functions.Function;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = "MainActivity";

    @Override
    protected void onCreate( Bundle savedInstanceState ) {

        super.onCreate( savedInstanceState );
        setContentView( R.layout.activity_main );
        initView();
    }

    private void initView() {

        Button click = (Button) findViewById( R.id.click );
        click.setOnClickListener( new OnClickListener() {

            @Override
            public void onClick( View v ) {

                new ConfirmDialogFragment().show( getSupportFragmentManager(), "" );
            }
        } );
        Button click00 = (Button) findViewById( R.id.click00 );
        click00.setOnClickListener( new OnClickListener() {

            @Override
            public void onClick( View v ) {

                new CancelConfirmDialogFragment().show( getSupportFragmentManager(), "" );
            }
        } );

        findViewById( R.id.bottomDialog ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                BottomDialogFragment bottomDialog = new BottomDialogFragment();
                bottomDialog.setDialogView( getLayoutInflater().inflate( R.layout.alert_tips, null ) );
                bottomDialog.show( getSupportFragmentManager(), "bottomDialog" );
            }
        } );

        Button click01 = (Button) findViewById( R.id.click01 );
        click01.setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                CrashActivity.start( v.getContext() );
            }
        } );

        findViewById( R.id.click05 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                List< Item > items = new ArrayList<>();
                items.add( new Item( "0", "item00", false ) );
                items.add( new Item( "0", "item00", true ) );
                SimpleBottomChooseDialogFragment dialog = new SimpleBottomChooseDialogFragment();
                dialog.setModels( items );
                dialog.setTextColor( getResources().getColor( R.color.teal_700 ), getResources().getColor( R.color.black ) );
                dialog.show( getSupportFragmentManager(), "" );
            }
        } );

        findViewById( R.id.bottomDialog02 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                List< Item > items = new ArrayList<>();

                items.add( new Item( "0", "item00", false ) );
                items.add( new Item( "0", "item00", true ) );
                for ( int i = 0; i < 18; i++ ) {
                    items.add( new Item( "0", "item00", false ) );
                }

                SimpleBottomChooseDialogFragment dialog = new SimpleBottomChooseDialogFragment();
                dialog.setModels( items );
                dialog.setTextColor( getResources().getColor( R.color.teal_700 ), getResources().getColor( R.color.black ) );
                dialog.show( getSupportFragmentManager(), "" );
            }
        } );

        findViewById( R.id.click06 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                CalendarPickerFactory.buildStartTodayPicker( v.getContext(), null ).show( getSupportFragmentManager(), "" );
            }
        } );

        findViewById( R.id.edit ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity2.start( v.getContext() );
            }
        } );

        findViewById( R.id.plateView ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity3.start( v.getContext() );
            }
        } );

        findViewById( R.id.popup ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity4.start( v.getContext() );
            }
        } );

        findViewById( R.id.recycler ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity5.start( v.getContext() );
            }
        } );

        findViewById( R.id.UIrecycle ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity6.start( v.getContext() );
            }
        } );

        findViewById( R.id.unBind ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity7.start( v.getContext() );
            }
        } );

        findViewById( R.id.unBindTest ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity8.start( v.getContext() );
            }
        } );

        findViewById( R.id.rxjava ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

            }
        } );

        findViewById( R.id.rxjava02 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity31.start( v.getContext() );
            }
        } );

        findViewById( R.id.tabLayout ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity10.start( v.getContext() );
            }
        } );

        findViewById( R.id.motionLayout ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity11.start( v.getContext() );
            }
        } );

        findViewById( R.id.motion2 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity12.start( v.getContext() );
            }
        } );

        findViewById( R.id.motion3 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity13.start( v.getContext() );
            }
        } );

        findViewById( R.id.motion4 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity14.start( v.getContext() );
            }
        } );

        findViewById( R.id.motion5 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity15.start( v.getContext() );
            }
        } );

        findViewById( R.id.motion6 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity16.start( v.getContext() );
            }
        } );

        findViewById( R.id.motion7 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity17.start( v.getContext() );
            }
        } );

        findViewById( R.id.motion8 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity22.start( v.getContext() );
            }
        } );

        findViewById( R.id.motion9 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity23.start( v.getContext() );
            }
        } );

        findViewById( R.id.motion11 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity25.start( v.getContext() );
            }
        } );

        findViewById( R.id.motion10 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity24.start( v.getContext() );
            }
        } );

        findViewById( R.id.motion12 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity26.start( v.getContext() );
            }
        } );

        findViewById( R.id.motion13 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity27.start( v.getContext() );
            }
        } );

        findViewById( R.id.motion14 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity28.start( v.getContext() );
            }
        } );

        findViewById( R.id.motion15 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity29.start( v.getContext() );
            }
        } );

        findViewById( R.id.motion16 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity32.start( v.getContext() );
            }
        } );

        findViewById( R.id.bottom ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity18.start( v.getContext() );
            }
        } );

        findViewById( R.id.bottom1 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity19.start( v.getContext() );
            }
        } );

        findViewById( R.id.date ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity20.start( v.getContext() );
            }
        } );

        findViewById( R.id.grid ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity21.start( v.getContext() );
            }
        } );

        findViewById( R.id.gridSpread ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity21_2.start( v.getContext() );
            }
        } );

        findViewById( R.id.rxjava01 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity30.start( v.getContext() );
            }
        } );

        findViewById( R.id.savedInstanceState ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity33.start( v.getContext() );
            }
        } );

        findViewById( R.id.swipe ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity34.start( v.getContext() );
            }
        } );

        findViewById( R.id.swipe2 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity35.start( v.getContext() );
            }
        } );

        findViewById( R.id.swipe3 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity36.start( v.getContext() );
            }
        } );

        findViewById( R.id.floatFrame ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity37.start( v.getContext() );
            }
        } );

        findViewById( R.id.setAdapter ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity38.start( v.getContext() );
            }
        } );
        findViewById( R.id.startup ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity38.start( v.getContext() );
            }
        } );

        findViewById( R.id.uid ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity39.start( v.getContext() );
            }
        } );

        findViewById( R.id.result ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity40.start( v.getContext() );
            }
        } );

        findViewById( R.id.permission ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                Permission.registerForPermissionResult( MainActivity.this.getSupportFragmentManager(),
                    permission.READ_EXTERNAL_STORAGE, new ActivityResultCallback< Boolean >() {
                        @Override
                        public void onActivityResult( Boolean result ) {

                            Logger.d( permission.READ_EXTERNAL_STORAGE + " : " + result );
                        }
                    } );
            }
        } );

        findViewById( R.id.swipeDismiss ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity41.start( view.getContext() );
            }
        } );

        findViewById( R.id.commandService ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity42.start( view.getContext() );
            }
        } );

        findViewById( R.id.sparking ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity43.start( view.getContext() );
            }
        } );

        findViewById( R.id.drawable ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity44.start( view.getContext() );
            }
        } );

        findViewById( R.id.dataStore ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity45.start( view.getContext() );
            }
        } );

        findViewById( R.id.dataStorePro ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity46.start( view.getContext() );
            }
        } );

        findViewById( R.id.file ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity47.start( view.getContext() );
            }
        } );

        findViewById( R.id.flow ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity48.start( view.getContext() );
            }
        } );

        findViewById( R.id.finishApp ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                App.finishApp( view.getContext() );
            }
        } );

        findViewById( R.id.dotPush ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity49.start( view.getContext() );
            }
        } );

        findViewById( R.id.onekey ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity50.start( view.getContext() );
            }
        } );

        findViewById( R.id.paging ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity51.start( view.getContext() );
            }
        } );

        findViewById( R.id.paging2 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity52.start( view.getContext() );
            }
        } );

        findViewById( R.id.room ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity53.start( view.getContext() );
            }
        } );

        findViewById( R.id.remote ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity54.start( view.getContext() );
            }
        } );

        findViewById( R.id.threadChange ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity54.start( view.getContext() );
            }
        } );

        findViewById( R.id.recycler2 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity56.start( view.getContext() );
            }
        } );

        findViewById( R.id.recycler3 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity57.start( view.getContext() );
            }
        } );

        findViewById( R.id.amap ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity59.start( view.getContext() );
            }
        } );

        findViewById( R.id.binder ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity60.start( view.getContext() );
            }
        } );

        findViewById( R.id.listAction ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity61.start( view.getContext() );
            }
        } );

        findViewById( R.id.rxjava03 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity62.start( v.getContext() );
            }
        } );

        findViewById( R.id.pageInPage ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity63.start( v.getContext() );
            }
        } );

        findViewById( R.id.flexBox ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity65.start( v.getContext() );
            }
        } );

        findViewById( R.id.takePic ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity66.start( v.getContext() );
            }
        } );

        findViewById( R.id.compress ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity68.start( v.getContext() );
            }
        } );

        findViewById( R.id.starter ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity69.start( v.getContext() );
            }
        } );

        findViewById( R.id.alertActivity ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity70.start( v.getContext() );
            }
        } );

        findViewById( R.id.notification ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity72.start( v.getContext() );
            }
        } );

        findViewById( R.id.input ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity73.start( v.getContext() );
            }
        } );

        findViewById( R.id.convertTime ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity74.start( v.getContext() );
            }
        } );

        findViewById( R.id.deepLink ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                //MainActivity75.start( v.getContext() );
                Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "appx://" ) );
                startActivity( intent );
            }
        } );

        findViewById( R.id.coor ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity76.start( v.getContext() );
            }
        } );

        findViewById( R.id.notificationSetting ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity77.start( v.getContext() );
            }
        } );

        findViewById( R.id.setResult ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity78.start( v.getContext() );
            }
        } );

        findViewById( R.id.banner ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity80.start( v.getContext() );
            }
        } );

        findViewById( R.id.shakeDialog ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity81.start( v.getContext() );
            }
        } );

        findViewById( R.id.timeSearch ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity82.start( v.getContext() );
            }
        } );

        findViewById( R.id.websocket ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity83.start( v.getContext() );
            }
        } );
        findViewById( R.id.capture ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity84.start( v.getContext() );
            }
        } );

        findViewById( R.id.connect ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity85.start( v.getContext() );
            }
        } );

        findViewById( R.id.p2p ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity86.start( v.getContext() );
            }
        } );

        findViewById( R.id.alarm ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity87.start( v.getContext() );
            }
        } );

        findViewById( R.id.ripple ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity88.start( v.getContext() );
            }
        } );

        findViewById( R.id.snap ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity89.start( v.getContext() );
            }
        } );

        findViewById( R.id.recyclerDec ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity90.start( v.getContext() );
            }
        } );

        findViewById( R.id.behavior ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity91.start( v.getContext() );
            }
        } );

        findViewById( R.id.vr ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity92.start( v.getContext() );
            }
        } );

        findViewById( R.id.nestedScroll ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity93.start( v.getContext() );
            }
        } );

        findViewById( R.id.nestedScroll2 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity94.start( v.getContext() );
            }
        } );

        findViewById( R.id.viewlocation ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                int[] temp = new int[2];
                v.getLocationOnScreen( temp );
                Logger.i( Arrays.toString( temp ) );

                v.getLocationInWindow( temp );
                Logger.i( Arrays.toString( temp ) );

                Rect rect = new Rect();
                v.getLocalVisibleRect( rect );
                Logger.i( rect.toString() );

                v.getGlobalVisibleRect( rect );
                Logger.i( rect.toString() );
            }
        } );

        findViewById( R.id.intentService ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MyIntentService.startActionFoo( v.getContext(), "hello ", "big world" );
            }
        } );

        findViewById( R.id.calendar ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity96.start( v.getContext() );
            }
        } );

        findViewById( R.id.section ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity97.start( v.getContext() );
            }
        } );

        findViewById( R.id.json ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity98.start( v.getContext() );
            }
        } );

        findViewById( R.id.fastAdapter ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity99.start( v.getContext() );
            }
        } );

        findViewById( R.id.adapterNotify ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity100.start( v.getContext() );
            }
        } );

        findViewById( R.id.inputSet ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity101.start( view.getContext() );
            }
        } );

        findViewById( R.id.drop0 ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity102.start( view.getContext() );
            }
        } );

        findViewById( R.id.pdfPick ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity103.start( view.getContext() );
            }
        } );

        findViewById( R.id.symbo ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity104.start( view.getContext() );
            }
        } );

        findViewById( R.id.DrawerLayout ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity105.start( view.getContext() );
            }
        } );

        findViewById( R.id.fullscreen ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity106.start( view.getContext() );
            }
        } );

        findViewById( R.id.picker ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity107.start( view.getContext() );
            }
        } );

        findViewById( R.id.bitmapWhite ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity108.start( view.getContext() );
            }
        } );

        findViewById( R.id.ringTone ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity109.start( view.getContext() );
            }
        } );

        findViewById( R.id.testNotify ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity110.start( view.getContext() );
            }
        } );

        findViewById( R.id.exoplayer ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity111.start( view.getContext() );
            }
        } );

        findViewById( R.id.waterMask ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity112.start( view.getContext() );
            }
        } );

        findViewById( R.id.viewModel ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View view ) {

                MainActivity113.start( view.getContext() );
            }
        } );

        findViewById( R.id.coroutines ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity114.start( v.getContext() );
            }
        } );

        findViewById( R.id.corners ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity115.start( v.getContext() );
            }
        } );

        findViewById( R.id.tts ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity116.start( v.getContext() );
            }
        } );

        findViewById( R.id.scrollPin ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity117.start( v.getContext() );
            }
        } );

        findViewById( R.id.softAdjustSpan ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity118.start( v.getContext() );
            }
        } );

        findViewById( R.id.foregroudService ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity119.start( v.getContext() );
            }
        } );

        findViewById( R.id.porterDuff ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity120.start( v.getContext() );
            }
        } );

        findViewById( R.id.textSwitcher ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity121.start( v.getContext() );
            }
        } );

        findViewById( R.id.lottie ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                MainActivity122.start( v.getContext() );
            }
        } );

        findViewById( R.id.locationQuick ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                new LocationPermissionServiceFunctionDialogImpl( v.getContext() ).quickProcessLocationPermissionService(
                    getSupportFragmentManager(),
                    new Runnable() {
                        @Override
                        public void run() {

                            CommonCode.showToastLong( v.getContext(), "成功" );

                        }
                    } );
            }
        } );

        findViewById( R.id.pickPhotoQuick ).setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                Context context = v.getContext();
                Observable.just( Permission.check( context, permission.READ_EXTERNAL_STORAGE ) )
                    .flatMap( new Function< Boolean, ObservableSource< Boolean > >() {
                        @Override
                        public ObservableSource< Boolean > apply( Boolean aBoolean ) throws Throwable {

                            /*1.检查权限*/
                            if ( aBoolean ) {
                                /*2.有权限,可以直接读取相册*/
                                return Observable.just( true );
                            } else {
                                /*2.没有权限*/
                                return Observable.create( new ObservableOnSubscribe< Boolean >() {
                                    @Override
                                    public void subscribe( @NonNull ObservableEmitter< Boolean > emitter ) throws Throwable {
                                        /*2.1没有权限,解释权限*/
                                        AlertDialog dialog = new Builder( context )
                                            .setTitle( "读取相册" )
                                            .setMessage( "申请读取相册,用于展示图片" )
                                            .setPositiveButton( "同意", new DialogInterface.OnClickListener() {
                                                @Override
                                                public void onClick( DialogInterface dialogInterface, int i ) {

                                                    dialogInterface.dismiss();
                                                    emitter.onNext( true );
                                                    emitter.onComplete();
                                                }
                                            } )
                                            .setNegativeButton( "不同意", new DialogInterface.OnClickListener() {
                                                @Override
                                                public void onClick( DialogInterface dialogInterface, int i ) {

                                                    dialogInterface.dismiss();
                                                    emitter.onError( new IllegalStateException( "不同意获取权限" ) );
                                                }
                                            } )
                                            .create();
                                        dialog.show();
                                    }
                                } ).flatMap( new Function< Boolean, ObservableSource< Boolean > >() {
                                    @Override
                                    public ObservableSource< Boolean > apply( Boolean aBoolean ) throws Throwable {
                                        /*2.1没有权限,解释权限,申请权限*/
                                        return Observable.create( new ObservableOnSubscribe< Boolean >() {
                                            @Override
                                            public void subscribe( @NonNull ObservableEmitter< Boolean > emitter ) throws Throwable {

                                                Permission.registerForPermissionResult( getSupportFragmentManager(), permission.READ_EXTERNAL_STORAGE, new ActivityResultCallback< Boolean >() {
                                                    @Override
                                                    public void onActivityResult( Boolean result ) {

                                                        emitter.onNext( result );
                                                        emitter.onComplete();
                                                    }
                                                } );
                                            }
                                        } );
                                    }
                                } ).flatMap( new Function< Boolean, ObservableSource< Boolean > >() {
                                    @Override
                                    public ObservableSource< Boolean > apply( Boolean aBoolean ) throws Throwable {
                                        /*2.1没有权限,解释权限,申请权限失败的话去app详情设置获取*/
                                        if ( aBoolean ) {
                                            return Observable.just( true );
                                        } else {
                                            return Observable.create( new ObservableOnSubscribe< Boolean >() {
                                                @Override
                                                public void subscribe( @NonNull ObservableEmitter< Boolean > emitter ) throws Throwable {

                                                    StartForResult.registerForActivityResult( getSupportFragmentManager(), IntentBuilder.appSettingIntent( context ), new ActivityResultCallback< ActivityResult >() {
                                                        @Override
                                                        public void onActivityResult( ActivityResult result ) {

                                                            boolean check = Permission.check( context, permission.READ_EXTERNAL_STORAGE );
                                                            if ( check ) {
                                                                emitter.onNext( true );
                                                                emitter.onComplete();
                                                            } else {
                                                                emitter.onError( new IllegalStateException( "用户没有允许权限" ) );
                                                            }
                                                        }
                                                    } );
                                                }
                                            } );
                                        }
                                    }
                                } );
                            }
                        }
                    } )
                    .flatMap( new Function< Boolean, ObservableSource< Uri > >() {
                        @SuppressLint( "CheckResult" )
                        @Override
                        public ObservableSource< Uri > apply( Boolean aBoolean ) throws Throwable {

                            if ( aBoolean ) {
                                return Observable.create( new ObservableOnSubscribe< Uri >() {
                                    @Override
                                    public void subscribe( @NonNull ObservableEmitter< Uri > emitter ) throws Throwable {

                                        TakePhoto.fromGallery( getSupportFragmentManager(), new ActivityResultCallback< Uri >() {
                                            @Override
                                            public void onActivityResult( Uri result ) {

                                                if ( result != null ) {
                                                    emitter.onNext( result );
                                                    emitter.onComplete();
                                                } else {
                                                    emitter.onError( new NullPointerException( "选择的图片为null" ) );
                                                }
                                            }
                                        } );
                                    }
                                } );
                            } else {
                                return Observable.error( new IllegalStateException( "无法选择图片" ) );
                            }
                        }
                    } ).subscribe( new Observer< Uri >() {
                        @Override
                        public void onSubscribe( @NonNull Disposable d ) {

                        }

                        @Override
                        public void onNext( @NonNull Uri uri ) {

                            Log.i( TAG, "onNext: " + uri );
                            CommonCode.showToast( context, "选择图片成功" + uri );
                        }

                        @Override
                        public void onError( @NonNull Throwable e ) {

                            Log.e( TAG, "onError: 快速选择图片", e );
                        }

                        @Override
                        public void onComplete() {

                        }
                    } );
            }
        } );
    }
}
